/**
 * @param {number[]} nums
 * @return {number[]}
*/
var runningSum = function(nums) {
  let result = new Array(nums.length);
  function sum(arr) {
    let result = 0;
    for(let i = 0; i < arr.length; i++) {
      result += arr[i];
    }
    return result;
  }
  for(let i = 0; i < nums.length; i++) {
    result[i] = sum(nums.slice(0, i + 1));
  }
  return result;
};
let nums = [1,2,3,4];
console.log(runningSum(nums));
nums = [1,1,1,1,1];
console.log(runningSum(nums));
nums = [3,1,2,10,1];
console.log(runningSum(nums));
